% GF_BIN_PRIMPOLY(M)   Return the primitive polynomials of specified 
% degree over a binary extension field 2^m
%
% This is a wrapper function for the function primpoly() from the Matlab
% Galois Field toolbox.  The toolbox is used in this case only to obtain
% primitive polynomials.
%
% Input: 
%
%   m        Return a polynomial of degree m from GF(2^m).  m<=1<=10.
%
% Output:
%   v        Vector representation of primitive polynomial (in order of
%            increasing powers of x).  Vector is in the form of an integer
%            array.

function v = gf_bin_primpoly(m)
    % Use primpoly to get a polynomial
    p = primpoly(m,'nodisplay');
    
    % Return the polynonmial as an integer array of the vector space
    % representation.
    x = fliplr(dec2bin(p));
    for i = 1:length(x)
        v(i) = str2double(x(i));
    end
end